package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqTogetherBusinessSettleSheet;
import com.ruoyi.hqfinance.domain.vo.HqTogetherBusinessSettleSheetVo;
import com.ruoyi.hqfinance.mapper.HqTogetherBusinessSettleSheetMapper;
import com.ruoyi.hqfinance.service.HqTogetherBusinessSettleSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqTogetherBusinessSettleSheetServiceImpl implements HqTogetherBusinessSettleSheetService {
    @Autowired
    private HqTogetherBusinessSettleSheetMapper hqTogetherBusinessSettleSheetMapper;

    @Override
    public List<HqTogetherBusinessSettleSheet> togetherBusinessSettleSheet(HqTogetherBusinessSettleSheetVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqTogetherBusinessSettleSheet> togetherBusinessSettleSheets = hqTogetherBusinessSettleSheetMapper.togetherBusinessSettleSheet(vo);
        assert togetherBusinessSettleSheets != null;
        for (HqTogetherBusinessSettleSheet hqTogetherBusinessSettleSheet : togetherBusinessSettleSheets){
            hqTogetherBusinessSettleSheet.setCode("124000");
            hqTogetherBusinessSettleSheet.setName("辽宁盘锦公司");
            if (vo.getCollectType() == 2){
                hqTogetherBusinessSettleSheet.setDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
        }
        return togetherBusinessSettleSheets;
    }
}
